<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>5. 关于框架设计和抽象 | 被删的前端游乐场</title>
    <meta name="description" content="Just playing around">
    
    
    <link rel="preload" href="/front-end-playground/assets/css/0.styles.a683ed26.css" as="style"><link rel="preload" href="/front-end-playground/assets/js/app.e5cf4092.js" as="script"><link rel="preload" href="/front-end-playground/assets/js/3.c853767c.js" as="script"><link rel="preload" href="/front-end-playground/assets/js/2.eed49fdd.js" as="script"><link rel="preload" href="/front-end-playground/assets/js/77.b830a59c.js" as="script">
    <link rel="stylesheet" href="/front-end-playground/assets/css/0.styles.a683ed26.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/front-end-playground/" class="home-link router-link-active"><!----> <span class="site-name">被删的前端游乐场</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/front-end-playground/" class="nav-link">概述</a></div><div class="nav-item"><a href="/front-end-playground/front-end-basic/" class="nav-link">前端基础</a></div><div class="nav-item"><a href="/front-end-playground/vue/" class="nav-link">Vue学习</a></div><div class="nav-item"><a href="/front-end-playground/wxapp/" class="nav-link">小程序学习</a></div><div class="nav-item"><a href="/front-end-playground/front-end-others/" class="nav-link router-link-active">百家齐放</a></div><div class="nav-item"><a href="/front-end-playground/front-end-addon/" class="nav-link">前端的进击</a></div><div class="nav-item"><a href="/front-end-playground/faq.html" class="nav-link">FAQ</a></div> <a href="https://github.com/godbasin/front-end-playground" target="_blank" rel="noopener noreferrer" class="repo-link">
    Github
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/front-end-playground/" class="nav-link">概述</a></div><div class="nav-item"><a href="/front-end-playground/front-end-basic/" class="nav-link">前端基础</a></div><div class="nav-item"><a href="/front-end-playground/vue/" class="nav-link">Vue学习</a></div><div class="nav-item"><a href="/front-end-playground/wxapp/" class="nav-link">小程序学习</a></div><div class="nav-item"><a href="/front-end-playground/front-end-others/" class="nav-link router-link-active">百家齐放</a></div><div class="nav-item"><a href="/front-end-playground/front-end-addon/" class="nav-link">前端的进击</a></div><div class="nav-item"><a href="/front-end-playground/faq.html" class="nav-link">FAQ</a></div> <a href="https://github.com/godbasin/front-end-playground" target="_blank" rel="noopener noreferrer" class="repo-link">
    Github
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0" style="padding-top:;"><!----> <p class="sidebar-heading"><span>玩转 Angular</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0" style="padding-top:10px;"><div class="kitty-main" data-v-0cd75e06><span class="stand" data-v-0cd75e06></span> <div class="cat" data-v-0cd75e06><div class="body" data-v-0cd75e06></div> <div class="head" data-v-0cd75e06><div class="ear" data-v-0cd75e06></div> <div class="ear" data-v-0cd75e06></div></div> <div class="face" data-v-0cd75e06><div class="nose" data-v-0cd75e06></div> <div class="whisker-container" data-v-0cd75e06><div class="whisker" data-v-0cd75e06></div> <div class="whisker" data-v-0cd75e06></div></div> <div class="whisker-container" data-v-0cd75e06><div class="whisker" data-v-0cd75e06></div> <div class="whisker" data-v-0cd75e06></div></div></div> <div class="tail-container" data-v-0cd75e06><div class="tail" data-v-0cd75e06><div class="tail" data-v-0cd75e06><div class="tail" data-v-0cd75e06><div class="tail" data-v-0cd75e06><div class="tail" data-v-0cd75e06><div class="tail" data-v-0cd75e06><div class="tail" data-v-0cd75e06></div></div></div></div></div></div></div></div></div></div> <p class="sidebar-heading open"><span>试试 Cycle.js</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/front-end-playground/front-end-others/cycle-js-test/1-init-app-with-webpack.html" class="sidebar-link">1. 用 Webpack 启动应用</a></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/2-use-cyclic-router.html" class="sidebar-link">2. 使用 cyclic-router 来启动路由</a></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/3-use-typescript.html" class="sidebar-link">3. 切换到 Typescript</a></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/4-use-class-build-input.html" class="sidebar-link">4. 使用 Class 和装饰器</a></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/5-design-and-abstraction.html" class="active sidebar-link">5. 关于框架设计和抽象</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/front-end-playground/front-end-others/cycle-js-test/5-design-and-abstraction.html#cycle-js-基础概念" class="sidebar-link">Cycle.js 基础概念</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/front-end-others/cycle-js-test/5-design-and-abstraction.html#结束语" class="sidebar-link">结束语</a></li></ul></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/6-merge-streams.html" class="sidebar-link">6. 合流</a></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/7-debug-input.html" class="sidebar-link">7. 定位 Input 组件值获取 bug</a></li><li><a href="/front-end-playground/front-end-others/cycle-js-test/8-two-way-binding.html" class="sidebar-link">8. 双向绑定 Input 值</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0" style="padding-top:;"><!----> <p class="sidebar-heading"><span>D3.js 和 Tree</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0" style="padding-top:;"><!----> <p class="sidebar-heading"><span>试试 Three.js</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0" style="padding-top:;"><!----> <p class="sidebar-heading"><span>BOX2D.js 文档与教程</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><p>因为对 Rxjs 的好感玩上了 Cycle.js，该系列用于记录使用该框架的一些笔记。本文我们来细细品味一下整个 Cyclejs 的核心--流，从不一样的角度开始思考吧。</p> <h2 id="cycle-js-基础概念"><a href="#cycle-js-基础概念" aria-hidden="true" class="header-anchor">#</a> Cycle.js 基础概念</h2> <p>基础知识什么时候恶补都不为晚。</p> <h3 id="人机交互"><a href="#人机交互" aria-hidden="true" class="header-anchor">#</a> 人机交互</h3> <p><a href="https://cycle.js.org/dialogue.html" target="_blank" rel="noopener noreferrer">官方文档<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>用了这么个高大上的词语形容，“对话抽象”(Dialogue abstraction)、“人机交互”(Human-Computer Interaction)，其实主要讲了以下个东西，容我接地气地讲讲。</p> <p>首先来看配图：</p> <p><img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/8JS%60Y%7B$TBJ1H%29%7B_~O6DI907.png" alt="image"></p> <p>先不管为什么官方文档要放这么一张逼死强迫症的缺个顶部的图片，这图片主要讲了一个轮回：</p> <ul><li>人 =&gt; 机：通过操作对机器进行输入，例如从键盘输入内容、用鼠标点击某些元素等</li> <li>机 =&gt; 人：机器拿到输入内容，根据程序进行计算，人通过眼睛观察得到输出</li></ul> <p>其实这里面主要是进行了这样一个抽象：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token parameter">输入</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  经过一些处理<span class="token punctuation">;</span>
  <span class="token keyword">return</span> 输出<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre></div><p>我们来看一个简单的场景：操作者需要登录一个页面。</p> <ol><li>对于操作者--人：</li></ol> <ul><li>输入 =&gt; 眼睛获得的图像</li> <li>处理 =&gt; 打开浏览器</li> <li>输出 =&gt; 输入一个地址，并按 Enter</li></ul> <ol start="2"><li>对于机器--电脑：</li></ol> <ul><li>输入 =&gt; 浏览器获得地址</li> <li>处理 =&gt; 解析地址，发送请求</li> <li>输出 =&gt; 返回一个登录页面</li></ul> <ol start="3"><li>对于操作者--人：</li></ol> <ul><li>输入 =&gt; 眼睛获得登录页面</li> <li>处理 =&gt; 键盘输入帐号密码，登录</li> <li>输出 =&gt; 上面的一系列操作便是输出</li></ul> <p>以上如此轮回的输入和输出，可以简单理解为人机交互。
其实我们在电脑上进行的每一个操作，每一个按键、鼠标移动的每一下，都可以理解为一次输出，也是电脑的一次输入。
而电脑每一个显示的变动或是不变，也都是输出，同时是人通过眼睛的一次输入。</p> <p>这里面的输入输出有各种的媒介：
电脑的输入包括键盘、鼠标等，输出包括显示器、音响等。
人的输入包括眼睛、耳朵等，输出包括手脚的移动、说话等。</p> <p>至于这些媒介，我们可以理解为一个接口，或是在 Cycle.js 里面，可以算是个驱动（Driver）吧，后面章节应该也会讲到。</p> <h3 id="对话抽象"><a href="#对话抽象" aria-hidden="true" class="header-anchor">#</a> 对话抽象</h3> <p>上面所说的人机交互，只是一层简单的抽象，而且也有比较主观的角度。</p> <p>这里我们尝试再进行一层抽象，不管是人还是机器，都是这样的物体：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token parameter">输入</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  经过一些处理<span class="token punctuation">;</span>
  <span class="token keyword">return</span> 输出<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre></div><p>现在我们假设，物体和物体之间的交流通过电、光，所以我们得到这样的物体：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token parameter">输入</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    光 <span class="token operator">=</span> 输入<span class="token punctuation">.</span>光
    处理光

    电 <span class="token operator">=</span> 输入<span class="token punctuation">.</span>电
    处理电

    <span class="token comment">// 输出</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
        光<span class="token punctuation">:</span> 处理后的光
        电<span class="token punctuation">:</span> 处理后的电
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><p>这大概是这个世界中所有物体的抽象了。</p> <p>这时候你可能会有些疑惑，如果每个物体都是这样，那承接这些光和电的传播途径或者方式呢？</p> <p>到这里，事情变得有意思了，理所当然地，承接这些光和电的便是我们的世界。
而我们的世界又是什么呢？其实也是这样一个抽象的物体：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">处理器</span><span class="token punctuation">(</span><span class="token parameter">输入</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
    光 <span class="token operator">=</span> 输入<span class="token punctuation">.</span>光
    处理光（传输光）

    电 <span class="token operator">=</span> 输入<span class="token punctuation">.</span>电
    处理电（传输电）

    <span class="token comment">// 输出</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
        光<span class="token punctuation">:</span> 处理后的光
        电<span class="token punctuation">:</span> 处理后的电
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token function">创建</span><span class="token punctuation">(</span>处理器<span class="token punctuation">,</span> <span class="token punctuation">{</span>
    光<span class="token punctuation">:</span> 创建光源（驱动器）
    电：创建电源（驱动器）
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><p>说白了，就是世界除了作为一个普通抽象物体，拥有对光和电的处理（例如传播过程减弱等等），同时还有一个特殊的任务：负责创建光和电的驱动。</p> <p>这个驱动是什么呢？</p> <h3 id="驱动"><a href="#驱动" aria-hidden="true" class="header-anchor">#</a> 驱动</h3> <p>这个驱动，跟我们平时理解的电脑的驱动有什么区别呢？其实说一样也是一样，说不一样也可以不一样。</p> <p>其实这里的驱动相当于一些规则，在这里我们理解为对光和电的规则：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">光驱动器</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token function">创建流</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    <span class="token function-variable function">天亮了</span><span class="token punctuation">:</span> <span class="token parameter">监听器</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      创建光
      光<span class="token punctuation">.</span><span class="token function-variable function">改变</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">增强<span class="token operator">/</span>减弱</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        监听器<span class="token punctuation">.</span><span class="token function">通知</span><span class="token punctuation">(</span>增强<span class="token operator">/</span>减弱<span class="token punctuation">)</span>
      <span class="token punctuation">}</span>
      光<span class="token punctuation">.</span><span class="token function-variable function">停止</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token parameter">停止</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
        监听器<span class="token punctuation">.</span><span class="token function">通知</span><span class="token punctuation">(</span>停止<span class="token punctuation">)</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token function-variable function">天黑了</span><span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      光<span class="token punctuation">.</span><span class="token function">消失</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre></div><p>中文的代码是不是看起来好难懂，简单的说，这里面包括一下规则：</p> <ol><li>光的传播处理（<code>改变 =&gt; 监听 =&gt; 通知</code>）</li> <li>光的出现消失（<code>出现 =&gt; 开始监听</code>, <code>消失 =&gt; 关闭监听</code>）</li></ol> <p>而所有的抽象物体里，输入和输出都遵守这样的处理。</p> <p>到这里，我们给这个世界创建了物体，然后规定了光和电的规则，创建世界的时候我们便开始根据设定运作起来。</p> <h3 id="流"><a href="#流" aria-hidden="true" class="header-anchor">#</a> 流</h3> <p>现在还剩下最后一个概念：流。</p> <p>其实流是最好理解的，它就是我们上面所说的光和电。</p> <p>我们创建一个世界之后：</p> <ol><li>流的规则设定好，流开始流动；</li> <li>流的流动，表现为世界对流的输入 =&gt; 处理 =&gt; 输出；</li> <li>物体和世界、物体间通过流来进行交流，表现为输入 =&gt; 处理 =&gt; 输出；</li> <li>若世界消失，流消失，物体无输入也便无输出，表现为消失。</li></ol> <p>[捂脸]感觉自己说的也好抽象，不过这是一个挺有意思的角度。不管 Cycle.js 适不适合用来做项目，但是这样一些新的想法和理念对设计和思路都能拓展空间。</p> <p>这样的思路拓展到我们的页面中，便有了 Cycle.js：</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">function</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token parameter">sources</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token comment">// 流的处理</span>

  <span class="token keyword">return</span> <span class="token punctuation">{</span>
    <span class="token constant">DOM</span><span class="token punctuation">:</span> <span class="token constant">DOM</span>$<span class="token punctuation">,</span> <span class="token comment">// 处理后的DOM流</span>
    router<span class="token punctuation">:</span> router$<span class="token punctuation">,</span> <span class="token comment">// 处理后的router流</span>
    <span class="token constant">HTTP</span><span class="token punctuation">:</span> <span class="token constant">HTTP</span>$ <span class="token comment">// 处理后的HTTP流</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token function">run</span><span class="token punctuation">(</span>main<span class="token punctuation">,</span> <span class="token punctuation">{</span>
  <span class="token constant">DOM</span><span class="token punctuation">:</span> <span class="token function">makeDOMDriver</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token comment">// DOM驱动</span>
  router<span class="token punctuation">:</span> <span class="token function">makeRouterDriver</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token comment">// 路由驱动</span>
  <span class="token constant">HTTP</span><span class="token punctuation">:</span> <span class="token function">makeHTTPDriver</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token comment">// HTTP驱动</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre></div><h2 id="结束语"><a href="#结束语" aria-hidden="true" class="header-anchor">#</a> 结束语</h2> <p>这节主要发挥本骚年的大脑洞，来进行思想探索。<br>
主要是尝试讲解了一下 Cycle.js 的设计思路，当然这只是本骚年的理解，或许有些理解不到位，甚至完全颠倒的地方，请多多包涵，和仅供参考。</p></div> <!----> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/godbasin/front-end-playground/edit/sourcecode/docs/front-end-others/cycle-js-test/5-design-and-abstraction.md" target="_blank" rel="noopener noreferrer">帮阿猪改善此页面！</a> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div> <!----> <blockquote>部分文章中使用了一些网站的截图，如果涉及侵权，请告诉我删一下谢谢~</blockquote> <div style="margin-top:30px;"><div class="el-row" style="margin-left:-10px;margin-right:-10px;"><div class="el-col el-col-24 el-col-sm-0 el-col-md-2 el-col-lg-4" style="padding-left:10px;padding-right:10px;display:block;"><div style="width:1px;height:1px;"></div></div> <div class="el-col el-col-24 el-col-sm-24 el-col-md-18 el-col-lg-16" style="padding-left:10px;padding-right:10px;"><div class="el-card box-card is-always-shadow"><div class="el-card__header"><div class="clearfix"><span>温馨提示喵</span></div></div><div class="el-card__body"> <div class="el-row" style="margin-left:-10px;margin-right:-10px;"><div class="el-col el-col-24 el-col-xs-24 el-col-sm-12" style="padding-left:10px;padding-right:10px;"><div class="el-image"><div class="image-slot"><img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/assets/img/loading.gif" style="width:100%;"></div><!----></div></div> <div class="el-col el-col-24 el-col-xs-24 el-col-sm-12" style="padding-left:10px;padding-right:10px;"><div class="copyright-text"><div>本文版权归作者所有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</div> <div>出处：被删的前端游乐场</div> <div>作者：<a href="https://github.com/godbasin" target="_blank">被删</a></div></div></div></div></div></div></div></div></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/front-end-playground/front-end-others/cycle-js-test/4-use-class-build-input.html" class="prev">
          4. 使用 Class 和装饰器
        </a></span> <span class="next"><a href="/front-end-playground/front-end-others/cycle-js-test/6-merge-streams.html">
          6. 合流
        </a>
        →
      </span></p></div>  <div class="gitalk-container theme-default-content"><div id="gitalk-container" class="content"></div></div></main> <div id="kitty-container"><span><div role="tooltip" id="el-popover-6398" aria-hidden="true" class="el-popover el-popper" style="width:undefinedpx;display:none;"><!----><img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/2code2.jpg" class="image"> <div class="text">牡羊猪的猫粮罐</div> </div><div id="kitty" style="background:url(https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/assets/img/kitty0.svg);"></div></span> <div class="el-dialog__wrapper" style="display:none;"><div role="dialog" aria-modal="true" aria-label="牡羊猪是这样渐渐胖成猪的喵（点击图片可以切换噢）" class="el-dialog" style="margin-top:15vh;"><div class="el-dialog__header"><span class="el-dialog__title">牡羊猪是这样渐渐胖成猪的喵（点击图片可以切换噢）</span><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i class="el-dialog__close el-icon el-icon-close"></i></button></div><!----><!----></div></div></div></div><div class="global-ui"></div></div>
    <script src="/front-end-playground/assets/js/app.e5cf4092.js" defer></script><script src="/front-end-playground/assets/js/3.c853767c.js" defer></script><script src="/front-end-playground/assets/js/2.eed49fdd.js" defer></script><script src="/front-end-playground/assets/js/77.b830a59c.js" defer></script>
  </body>
</html>
